package com.qpx.zhoukaofile.dao;

import com.qpx.zhoukaofile.entity.FileEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface FileDao  extends JpaRepository<FileEntity,Integer> {
    public List<FileEntity> findByMid(int mid);

    @Modifying
    @Transactional
    @Query("delete from FileEntity where mid in (:mids)")
    public void deleteAllByMid(@Param("mids") List<Integer> mids);
}
